<test>
    <settings>
        <max_memory_usage>30000000000</max_memory_usage>
    </settings>

    <substitutions>
        <substitution>
            <name>arg</name>
            <values>
                <value>u8</value>
                <value>u16</value>
                <value>u32</value>
                <value>u64</value>
                <value>i8</value>
                <value>i16</value>
                <value>i32</value>
                <value>i64</value>
                <value>f32</value>
                <value>f64</value>
            </values>
        </substitution>
        <substitution>
            <name>op</name>
            <values>
                <value>plus</value>
                <value>minus</value>
                <value>multiply</value>
                <value>divide</value>
                <value>intDivOrZero</value>
                <value>moduloOrZero</value>
            </values>
        </substitution>
    </substitutions>

    <create_query>
        CREATE TABLE nums ENGINE Memory AS
        WITH number as x
        SELECT
            toUInt8(x)   u8,
            toUInt16(x)  u16,
            toUInt32(x)  u32,
            toUInt64(x)  u64,
            toInt8(x)    i8,
            toInt16(x)   i16,
            toInt32(x)   i32,
            toInt64(x)   i64,
            toFloat32(x) f32,
            toFloat64(x) f64
        FROM numbers_mt(200000000)
        SETTINGS max_threads = 4
        ;
    </create_query>

    <query>SELECT count() FROM nums WHERE NOT ignore(
        {op}({arg}, {arg}),
        {op}({arg}, {arg} + 1),
        {op}({arg}, {arg} + 2),
        {op}({arg}, {arg} + 3),
        {op}({arg}, {arg} + 4),
        {op}({arg}, {arg} + 5),
        {op}({arg}, {arg} + 6),
        {op}({arg}, {arg} + 7)
        )</query>

    <drop_query>DROP TABLE nums</drop_query>
</test>
